import request from '@/config/axios'

// 检验类型 VO
export interface InspectionTypeVO {
  id: number // 主键id
  typeCode: string // 检验编码
  typeId: number // 检验类型id（字典维护）
  processId: number // 工序id
  productId: number // 产品id
  lineCode: string // 产线编码
  status: number // 状态（1启用 0未启用）
}

// 检验类型 API
export const InspectionTypeApi = {
  // 查询检验类型分页
  getInspectionTypePage: async (params: any) => {
    return await request.get({ url: `/opticore/inspection-type/page`, params })
  },

  // 查询检验类型详情
  getInspectionType: async (id: number) => {
    return await request.get({ url: `/opticore/inspection-type/get?id=` + id })
  },

  // 获取检测类型编码
  getTypeCode: async () => {
    return await request.get({url: `/opticore/inspection-type/create_code`})
  },

  // 新增检验类型
  createInspectionType: async (data: InspectionTypeVO) => {
    return await request.post({ url: `/opticore/inspection-type/create`, data })
  },

  // 修改检验类型
  updateInspectionType: async (data: InspectionTypeVO) => {
    return await request.put({ url: `/opticore/inspection-type/update`, data })
  },

  // 删除检验类型
  deleteInspectionType: async (id: number) => {
    return await request.delete({ url: `/opticore/inspection-type/delete?id=` + id })
  },

  // 导出检验类型 Excel
  exportInspectionType: async (params) => {
    return await request.download({ url: `/opticore/inspection-type/export-excel`, params })
  },
  //导出检验类型模版
    // 获取导入模板
    importInspectionTemplate: async () => {
      return await request.download({ url: `/opticore/inspection-type/get-import-template`})
    }
}
